package org.jeecg.modules.iot.service;

import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.iot.model.v20180120.PubResponse;
import org.jeecg.modules.iot.aliyun.DeviceConfig;
import org.jeecg.modules.iot.aliyun.MessageBody;
import org.jeecg.modules.iot.message.ReceivePopupSN;
import org.jeecg.modules.iot.message.ReceiveUpload;

/**
 * 这里是一个注释
 *
 * @author scw
 * @version v1.0
 * @date
 */
public interface IotDeviceService {


    /**
     * 删除设备
     */
    void delDevice(String deviceName) throws Exception;
    /**
     * 注册设备
     */
    void registerDevice(String deviceName) throws Exception;

    /**
     * 根据生成二维码的ID查询绑定设备的轮巡充数
     * @param qrCodeId
     * @return
     */
    Integer getDevice(String qrCodeId);
    /**
     * 获取MQTT鉴权地址
     * https://help.aliyun.com/document_detail/73742.html?spm=a2c4g.11186623.6.587.69fa1bb8kGHsBc
     * 使用HTTPS认证再连接
     * @param deviceName 设备名称
     * @return 阿里云返回设备的登录MQTT的账号和密码
     * @throws Exception 异常
     */
    DeviceConfig getIotDeviceConfig(String deviceName) throws Exception;
    /**
     * 整机上报
     * @param rentBoxSN
     * @param messageBody
     */
    void uploadData(String rentBoxSN, MessageBody messageBody);
    /**
     * 发送异步消息
     */
    PubResponse sendMsgAsync(String deviceName, String messageContent, int qos) throws ClientException;

    ReceiveUpload check(String rentboxSN) throws Exception;

    ReceiveUpload checkAll(String rentboxSN) throws Exception;

    ReceivePopupSN popupByRandom(String rentboxSN, int minPower) throws Exception;

}
